package com.example.bookstore.dao

import com.example.bookstore.entity.BookEntity
import org.springframework.data.jpa.repository.Query

/**
 * Created by IntelliJ IDEA.
 * User: lvshe
 * Date: 2019/8/10
 * Time: 15:08
 */
interface BookDao : BaseDao<BookEntity> {

    @Query("SELECT * FROM book_entity ORDER BY rand() LIMIT ?1", nativeQuery = true)
    fun getRandomBooks(number: Int): Set<BookEntity>

}